﻿using System;
namespace sametexts_u8
{
    using ExcelConfig.Config;
    using ExcelConfig.StoreAPI;
    using System.IO;

    public static class SQLRunnerInit
    {
        internal const string ConfigPath = "./config";
        internal const string ConfigName = "app";
        public static void Do()
        {
            if (!Directory.Exists(ConfigPath)) Directory.CreateDirectory(ConfigPath);
            var filepath = Path.Combine(ConfigPath, ConfigName+ ExcelConfigSetting.CONFIG_SUFFIX);
            if (!File.Exists(filepath)) ConfigStoreAPI.DownloadToFile("u8-sql-tool", ConfigName, filepath);
        }

        internal static AppConfigFile GetConfig()
        {
            Do();
            return new AppConfigFile(ConfigPath, ConfigName);
        }
    }
}
